DEPTH = ../..

include $(DEPTH)/scripts/Makefile

PROGRAM     = ApacheLogLoader
SRCS        = $(PROGRAM).cxx
LIBS        = -lTimestamp

DATABASE    = ApacheLog.db
LOGFILE     = /opt/local/apache2/logs/access_log

demo: clean all runDemo checkDemo

runDemo: 
	@$(SCRIPTS_DIR)/progress 'Run Demo'
	./$(PROGRAM) $(DATABASE) $(LOGFILE) 30000

debugDemo:
	@$(SCRIPTS_DIR)/progress 'Run Demo'
	@echo "Type 'run $(DATABASE) $(LOGFILE) 100'"
	gdb ./$(PROGRAM)

checkDemo: 
	@$(SCRIPTS_DIR)/progress 'Check Demo'
	@../sqlite3/SQLiteDemo $(DATABASE) "SELECT COUNT(*) FROM apacheLog_request"

all: $(PROGRAM)

$(PROGRAM): $(SRCS)
	@$(SCRIPTS_DIR)/progress 'Building Demo'
	@$(GPP) $(CFLAGS) $? $(LDFLAGS) $(LIBS) -o $@

clean: 
	@$(SCRIPTS_DIR)/progress 'Cleaning'
	@rm -f $(PROGRAM)
	@rm -f $(DATABASE)
